/***************************************************************************
 *   CreaTV Digital - Herramienta para la creación de aplicaciones NCL para
 *   el middleware GINGA de Televisión Digital Terrestre
 *
 *  Copyright © 2010, 2011
 *        -Cardozo, Sergio A. (yojajo@gmail.com)
 *        -Schwartz, Sebastian M. (seba.schwartz.7@gmail.com)
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ****************************************************************************/

/*!
*\file NCL/compoundaction.cpp
*\author Sergio A. Cardozo (yojajo@gmail.com)
*\author Sebastian M. Schwatrz (seba.schwartz.7@gmail.com)
*\date May 2011
*\version 0.1
*\note A file containing the methods implementation to create an compoundAction entity.
*/

#include "compoundaction.h"

CompoundAction::CompoundAction(QString operatorCParam, SimpleAction simpleActionParam)
{
    operatorC = operatorCParam;
    simpleAction = simpleActionParam.getSimpleAction();
    subCompoundAction = "";
    delay = "";
}

CompoundAction::CompoundAction(QString operatorCParam, CompoundAction compoundActionParam)
{
    operatorC = operatorCParam;
    simpleAction = "";
    subCompoundAction = compoundActionParam.getCompoundAction();
    delay = "";
}

QString CompoundAction::getCompoundAction()
{
    compoundAction = "\t\t\t\t\t<compoundSAction operator=\""+operatorC+"\""+delay+">\n";
    compoundAction.append(simpleAction);
    compoundAction.append(subCompoundAction);
    compoundAction.append("\t\t\t\t\t</compoundSAction>\n");
    return compoundAction;
}

void CompoundAction::addSimpleAction(SimpleAction simpleActionParam)
{
    simpleAction.append(simpleActionParam.getSimpleAction());
}

void CompoundAction::addCompoundAction(CompoundAction compoundActionAction)
{
    subCompoundAction.append("\t"+compoundActionAction.getCompoundAction());
}


void CompoundAction::setDelay(QString delayParam)
{
    delay = delayParam;
}
